<template>
	<view>
		<button :loading="disabled" class="i-btn" :class="[btnClass]"  @click="fnClickEvent">
			<slot>提交</slot>
		</button>
	</view>
</template>

<script>
	export default{
		props:{
			delay:{
				type:Number,
				default:1000
			},
			btnClass:{}
			
		},
		data(){
			return{
				disabled:false,
			}
		},
		methods:{
			fnClickEvent(e){
				if(!this.disabled){
					this.disabled=true
					this.$emit('click',e)
					setTimeout(()=>{
						this.disabled=false
					},this.delay)
				}
			}
		}
	}
</script>

<style lang="scss">
	.i-btn{
		background: #ff9900;
		color: #fff;
		&:active{
			background-color: #ffad33;
		}
		&::after{
			border: 0;
		}
	}
	.ttt{
		background-color: #007AFF;
	}
</style>
